#include <QtCore>

#include "TranSrv.h"
#include "ComStruct.h"
#include "LogFile.h"
#include "ComDefine.h"
#include "KgBackTrace.h"

#ifdef XNWIN              // WIN
#include <windows.h>
#else// Linux
#include <unistd.h>
#endif

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    InitBackTrace(); //先初始化异常处理

    QDir::setCurrent(QCoreApplication::applicationDirPath());

    CTranSrv tranSrv;

#ifdef XNWIN
    Sleep(500); //500 ms
#else
    usleep(500 * 1000); //500 ms
#endif

    if (tranSrv.init() < 0)
    {
        KG_LOG_INFO("初始化失败,不能开启数据转发服务,程序将退出");
        return -1;
    }
    else
    {
        KG_LOG_INFO("初始化成功,将开启数据转发服务");
        tranSrv.startSrv();
    }

    return a.exec();
}
